<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Source code</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<main role="main">
<div class="sourceContainer">
<pre><span class="sourceLineNo">001</span><a id="line.1">/*</a>
<span class="sourceLineNo">002</span><a id="line.2"> * Licensed to the Apache Software Foundation (ASF) under one or more</a>
<span class="sourceLineNo">003</span><a id="line.3"> * contributor license agreements.  See the NOTICE file distributed with</a>
<span class="sourceLineNo">004</span><a id="line.4"> * this work for additional information regarding copyright ownership.</a>
<span class="sourceLineNo">005</span><a id="line.5"> * The ASF licenses this file to You under the Apache License, Version 2.0</a>
<span class="sourceLineNo">006</span><a id="line.6"> * (the "License"); you may not use this file except in compliance with</a>
<span class="sourceLineNo">007</span><a id="line.7"> * the License.  You may obtain a copy of the License at</a>
<span class="sourceLineNo">008</span><a id="line.8"> *</a>
<span class="sourceLineNo">009</span><a id="line.9"> *      http://www.apache.org/licenses/LICENSE-2.0</a>
<span class="sourceLineNo">010</span><a id="line.10"> *</a>
<span class="sourceLineNo">011</span><a id="line.11"> * Unless required by applicable law or agreed to in writing, software</a>
<span class="sourceLineNo">012</span><a id="line.12"> * distributed under the License is distributed on an "AS IS" BASIS,</a>
<span class="sourceLineNo">013</span><a id="line.13"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</a>
<span class="sourceLineNo">014</span><a id="line.14"> * See the License for the specific language governing permissions and</a>
<span class="sourceLineNo">015</span><a id="line.15"> * limitations under the License.</a>
<span class="sourceLineNo">016</span><a id="line.16"> */</a>
<span class="sourceLineNo">017</span><a id="line.17">package org.apache.commons.dbutils.wrappers;</a>
<span class="sourceLineNo">018</span><a id="line.18"></a>
<span class="sourceLineNo">019</span><a id="line.19">import java.io.InputStream;</a>
<span class="sourceLineNo">020</span><a id="line.20">import java.io.Reader;</a>
<span class="sourceLineNo">021</span><a id="line.21">import java.lang.reflect.InvocationHandler;</a>
<span class="sourceLineNo">022</span><a id="line.22">import java.lang.reflect.Method;</a>
<span class="sourceLineNo">023</span><a id="line.23">import java.math.BigDecimal;</a>
<span class="sourceLineNo">024</span><a id="line.24">import java.net.URL;</a>
<span class="sourceLineNo">025</span><a id="line.25">import java.sql.Blob;</a>
<span class="sourceLineNo">026</span><a id="line.26">import java.sql.Clob;</a>
<span class="sourceLineNo">027</span><a id="line.27">import java.sql.Date;</a>
<span class="sourceLineNo">028</span><a id="line.28">import java.sql.Ref;</a>
<span class="sourceLineNo">029</span><a id="line.29">import java.sql.ResultSet;</a>
<span class="sourceLineNo">030</span><a id="line.30">import java.sql.Time;</a>
<span class="sourceLineNo">031</span><a id="line.31">import java.sql.Timestamp;</a>
<span class="sourceLineNo">032</span><a id="line.32">import java.util.HashMap;</a>
<span class="sourceLineNo">033</span><a id="line.33">import java.util.Map;</a>
<span class="sourceLineNo">034</span><a id="line.34"></a>
<span class="sourceLineNo">035</span><a id="line.35">import org.apache.commons.dbutils.ProxyFactory;</a>
<span class="sourceLineNo">036</span><a id="line.36"></a>
<span class="sourceLineNo">037</span><a id="line.37">/**</a>
<span class="sourceLineNo">038</span><a id="line.38"> * Decorates a {@code ResultSet} with checks for a SQL NULL value on each</a>
<span class="sourceLineNo">039</span><a id="line.39"> * {@code getXXX} method. If a column value obtained by a</a>
<span class="sourceLineNo">040</span><a id="line.40"> * {@code getXXX} method is not SQL NULL, the column value is returned. If</a>
<span class="sourceLineNo">041</span><a id="line.41"> * the column value is SQL null, an alternate value is returned. The alternate</a>
<span class="sourceLineNo">042</span><a id="line.42"> * value defaults to the Java {@code null} value, which can be overridden</a>
<span class="sourceLineNo">043</span><a id="line.43"> * for instances of the class.</a>
<span class="sourceLineNo">044</span><a id="line.44"> *</a>
<span class="sourceLineNo">045</span><a id="line.45"> * &lt;p&gt;</a>
<span class="sourceLineNo">046</span><a id="line.46"> * Usage example:</a>
<span class="sourceLineNo">047</span><a id="line.47"> * &lt;blockquote&gt;</a>
<span class="sourceLineNo">048</span><a id="line.48"> * &lt;pre&gt;</a>
<span class="sourceLineNo">049</span><a id="line.49"> * Connection conn = // somehow get a connection</a>
<span class="sourceLineNo">050</span><a id="line.50"> * Statement stmt = conn.createStatement();</a>
<span class="sourceLineNo">051</span><a id="line.51"> * ResultSet rs = stmt.executeQuery("SELECT col1, col2 FROM table1");</a>
<span class="sourceLineNo">052</span><a id="line.52"> *</a>
<span class="sourceLineNo">053</span><a id="line.53"> * // Wrap the result set for SQL NULL checking</a>
<span class="sourceLineNo">054</span><a id="line.54"> * SqlNullCheckedResultSet wrapper = new SqlNullCheckedResultSet(rs);</a>
<span class="sourceLineNo">055</span><a id="line.55"> * wrapper.setNullString("---N/A---"); // Set null string</a>
<span class="sourceLineNo">056</span><a id="line.56"> * wrapper.setNullInt(-999); // Set null integer</a>
<span class="sourceLineNo">057</span><a id="line.57"> * rs = ProxyFactory.instance().createResultSet(wrapper);</a>
<span class="sourceLineNo">058</span><a id="line.58"> *</a>
<span class="sourceLineNo">059</span><a id="line.59"> * while (rs.next()) {</a>
<span class="sourceLineNo">060</span><a id="line.60"> *     // If col1 is SQL NULL, value returned will be "---N/A---"</a>
<span class="sourceLineNo">061</span><a id="line.61"> *     String col1 = rs.getString("col1");</a>
<span class="sourceLineNo">062</span><a id="line.62"> *     // If col2 is SQL NULL, value returned will be -999</a>
<span class="sourceLineNo">063</span><a id="line.63"> *     int col2 = rs.getInt("col2");</a>
<span class="sourceLineNo">064</span><a id="line.64"> * }</a>
<span class="sourceLineNo">065</span><a id="line.65"> * rs.close();</a>
<span class="sourceLineNo">066</span><a id="line.66"> * &lt;/pre&gt;</a>
<span class="sourceLineNo">067</span><a id="line.67"> * &lt;/blockquote&gt;</a>
<span class="sourceLineNo">068</span><a id="line.68"> * &amp;lt;/p&amp;gt;</a>
<span class="sourceLineNo">069</span><a id="line.69"> * &lt;p&gt;Unlike some other classes in DbUtils, this class is NOT thread-safe.&lt;/p&gt;</a>
<span class="sourceLineNo">070</span><a id="line.70"> */</a>
<span class="sourceLineNo">071</span><a id="line.71">public class SqlNullCheckedResultSet implements InvocationHandler {</a>
<span class="sourceLineNo">072</span><a id="line.72"></a>
<span class="sourceLineNo">073</span><a id="line.73">    /**</a>
<span class="sourceLineNo">074</span><a id="line.74">     * Maps normal method names (ie. "getBigDecimal") to the corresponding null</a>
<span class="sourceLineNo">075</span><a id="line.75">     * Method object (ie. getNullBigDecimal).</a>
<span class="sourceLineNo">076</span><a id="line.76">     */</a>
<span class="sourceLineNo">077</span><a id="line.77">    private static final Map&lt;String, Method&gt; nullMethods = new HashMap&lt;&gt;();</a>
<span class="sourceLineNo">078</span><a id="line.78"></a>
<span class="sourceLineNo">079</span><a id="line.79">    /**</a>
<span class="sourceLineNo">080</span><a id="line.80">     * The {@code getNull} string prefix.</a>
<span class="sourceLineNo">081</span><a id="line.81">     * @since 1.4</a>
<span class="sourceLineNo">082</span><a id="line.82">     */</a>
<span class="sourceLineNo">083</span><a id="line.83">    private static final String GET_NULL_PREFIX = "getNull";</a>
<span class="sourceLineNo">084</span><a id="line.84"></a>
<span class="sourceLineNo">085</span><a id="line.85">    static {</a>
<span class="sourceLineNo">086</span><a id="line.86">        final Method[] methods = SqlNullCheckedResultSet.class.getMethods();</a>
<span class="sourceLineNo">087</span><a id="line.87">        for (Method method : methods) {</a>
<span class="sourceLineNo">088</span><a id="line.88">            final String methodName = method.getName();</a>
<span class="sourceLineNo">089</span><a id="line.89"></a>
<span class="sourceLineNo">090</span><a id="line.90">            if (methodName.startsWith(GET_NULL_PREFIX)) {</a>
<span class="sourceLineNo">091</span><a id="line.91">                final String normalName = "get" + methodName.substring(GET_NULL_PREFIX.length());</a>
<span class="sourceLineNo">092</span><a id="line.92">                nullMethods.put(normalName, method);</a>
<span class="sourceLineNo">093</span><a id="line.93">            }</a>
<span class="sourceLineNo">094</span><a id="line.94">        }</a>
<span class="sourceLineNo">095</span><a id="line.95">    }</a>
<span class="sourceLineNo">096</span><a id="line.96"></a>
<span class="sourceLineNo">097</span><a id="line.97">    /**</a>
<span class="sourceLineNo">098</span><a id="line.98">     * The factory to create proxies with.</a>
<span class="sourceLineNo">099</span><a id="line.99">     */</a>
<span class="sourceLineNo">100</span><a id="line.100">    private static final ProxyFactory factory = ProxyFactory.instance();</a>
<span class="sourceLineNo">101</span><a id="line.101"></a>
<span class="sourceLineNo">102</span><a id="line.102">    /**</a>
<span class="sourceLineNo">103</span><a id="line.103">     * Wraps the {@code ResultSet} in an instance of this class.  This is</a>
<span class="sourceLineNo">104</span><a id="line.104">     * equivalent to:</a>
<span class="sourceLineNo">105</span><a id="line.105">     * &lt;pre&gt;</a>
<span class="sourceLineNo">106</span><a id="line.106">     * ProxyFactory.instance().createResultSet(new SqlNullCheckedResultSet(rs));</a>
<span class="sourceLineNo">107</span><a id="line.107">     * &lt;/pre&gt;</a>
<span class="sourceLineNo">108</span><a id="line.108">     *</a>
<span class="sourceLineNo">109</span><a id="line.109">     * @param rs The {@code ResultSet} to wrap.</a>
<span class="sourceLineNo">110</span><a id="line.110">     * @return wrapped ResultSet</a>
<span class="sourceLineNo">111</span><a id="line.111">     */</a>
<span class="sourceLineNo">112</span><a id="line.112">    public static ResultSet wrap(final ResultSet rs) {</a>
<span class="sourceLineNo">113</span><a id="line.113">        return factory.createResultSet(new SqlNullCheckedResultSet(rs));</a>
<span class="sourceLineNo">114</span><a id="line.114">    }</a>
<span class="sourceLineNo">115</span><a id="line.115"></a>
<span class="sourceLineNo">116</span><a id="line.116">    private InputStream nullAsciiStream = null;</a>
<span class="sourceLineNo">117</span><a id="line.117">    private BigDecimal nullBigDecimal = null;</a>
<span class="sourceLineNo">118</span><a id="line.118">    private InputStream nullBinaryStream = null;</a>
<span class="sourceLineNo">119</span><a id="line.119">    private Blob nullBlob = null;</a>
<span class="sourceLineNo">120</span><a id="line.120">    private boolean nullBoolean = false;</a>
<span class="sourceLineNo">121</span><a id="line.121">    private byte nullByte = 0;</a>
<span class="sourceLineNo">122</span><a id="line.122">    private byte[] nullBytes = null;</a>
<span class="sourceLineNo">123</span><a id="line.123">    private Reader nullCharacterStream = null;</a>
<span class="sourceLineNo">124</span><a id="line.124">    private Clob nullClob = null;</a>
<span class="sourceLineNo">125</span><a id="line.125">    private Date nullDate = null;</a>
<span class="sourceLineNo">126</span><a id="line.126">    private double nullDouble = 0.0;</a>
<span class="sourceLineNo">127</span><a id="line.127">    private float nullFloat = 0.0f;</a>
<span class="sourceLineNo">128</span><a id="line.128">    private int nullInt = 0;</a>
<span class="sourceLineNo">129</span><a id="line.129">    private long nullLong = 0;</a>
<span class="sourceLineNo">130</span><a id="line.130">    private Object nullObject = null;</a>
<span class="sourceLineNo">131</span><a id="line.131">    private Ref nullRef = null;</a>
<span class="sourceLineNo">132</span><a id="line.132">    private short nullShort = 0;</a>
<span class="sourceLineNo">133</span><a id="line.133">    private String nullString = null;</a>
<span class="sourceLineNo">134</span><a id="line.134">    private Time nullTime = null;</a>
<span class="sourceLineNo">135</span><a id="line.135">    private Timestamp nullTimestamp = null;</a>
<span class="sourceLineNo">136</span><a id="line.136">    private URL nullURL = null;</a>
<span class="sourceLineNo">137</span><a id="line.137"></a>
<span class="sourceLineNo">138</span><a id="line.138">    /**</a>
<span class="sourceLineNo">139</span><a id="line.139">     * The wrapped result.</a>
<span class="sourceLineNo">140</span><a id="line.140">     */</a>
<span class="sourceLineNo">141</span><a id="line.141">    private final ResultSet rs;</a>
<span class="sourceLineNo">142</span><a id="line.142"></a>
<span class="sourceLineNo">143</span><a id="line.143">    /**</a>
<span class="sourceLineNo">144</span><a id="line.144">     * Constructs a new instance of</a>
<span class="sourceLineNo">145</span><a id="line.145">     * {@code SqlNullCheckedResultSet}</a>
<span class="sourceLineNo">146</span><a id="line.146">     * to wrap the specified {@code ResultSet}.</a>
<span class="sourceLineNo">147</span><a id="line.147">     * @param rs ResultSet to wrap</a>
<span class="sourceLineNo">148</span><a id="line.148">     */</a>
<span class="sourceLineNo">149</span><a id="line.149">    public SqlNullCheckedResultSet(final ResultSet rs) {</a>
<span class="sourceLineNo">150</span><a id="line.150">        super();</a>
<span class="sourceLineNo">151</span><a id="line.151">        this.rs = rs;</a>
<span class="sourceLineNo">152</span><a id="line.152">    }</a>
<span class="sourceLineNo">153</span><a id="line.153"></a>
<span class="sourceLineNo">154</span><a id="line.154">    /**</a>
<span class="sourceLineNo">155</span><a id="line.155">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">156</span><a id="line.156">     * invoking a {@code getAsciiStream} method.</a>
<span class="sourceLineNo">157</span><a id="line.157">     *</a>
<span class="sourceLineNo">158</span><a id="line.158">     * @return the value</a>
<span class="sourceLineNo">159</span><a id="line.159">     */</a>
<span class="sourceLineNo">160</span><a id="line.160">    public InputStream getNullAsciiStream() {</a>
<span class="sourceLineNo">161</span><a id="line.161">        return this.nullAsciiStream;</a>
<span class="sourceLineNo">162</span><a id="line.162">    }</a>
<span class="sourceLineNo">163</span><a id="line.163"></a>
<span class="sourceLineNo">164</span><a id="line.164">    /**</a>
<span class="sourceLineNo">165</span><a id="line.165">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">166</span><a id="line.166">     * invoking a {@code getBigDecimal} method.</a>
<span class="sourceLineNo">167</span><a id="line.167">     *</a>
<span class="sourceLineNo">168</span><a id="line.168">     * @return the value</a>
<span class="sourceLineNo">169</span><a id="line.169">     */</a>
<span class="sourceLineNo">170</span><a id="line.170">    public BigDecimal getNullBigDecimal() {</a>
<span class="sourceLineNo">171</span><a id="line.171">        return this.nullBigDecimal;</a>
<span class="sourceLineNo">172</span><a id="line.172">    }</a>
<span class="sourceLineNo">173</span><a id="line.173"></a>
<span class="sourceLineNo">174</span><a id="line.174">    /**</a>
<span class="sourceLineNo">175</span><a id="line.175">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">176</span><a id="line.176">     * invoking a {@code getBinaryStream} method.</a>
<span class="sourceLineNo">177</span><a id="line.177">     *</a>
<span class="sourceLineNo">178</span><a id="line.178">     * @return the value</a>
<span class="sourceLineNo">179</span><a id="line.179">     */</a>
<span class="sourceLineNo">180</span><a id="line.180">    public InputStream getNullBinaryStream() {</a>
<span class="sourceLineNo">181</span><a id="line.181">        return this.nullBinaryStream;</a>
<span class="sourceLineNo">182</span><a id="line.182">    }</a>
<span class="sourceLineNo">183</span><a id="line.183"></a>
<span class="sourceLineNo">184</span><a id="line.184">    /**</a>
<span class="sourceLineNo">185</span><a id="line.185">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">186</span><a id="line.186">     * invoking a {@code getBlob} method.</a>
<span class="sourceLineNo">187</span><a id="line.187">     *</a>
<span class="sourceLineNo">188</span><a id="line.188">     * @return the value</a>
<span class="sourceLineNo">189</span><a id="line.189">     */</a>
<span class="sourceLineNo">190</span><a id="line.190">    public Blob getNullBlob() {</a>
<span class="sourceLineNo">191</span><a id="line.191">        return this.nullBlob;</a>
<span class="sourceLineNo">192</span><a id="line.192">    }</a>
<span class="sourceLineNo">193</span><a id="line.193"></a>
<span class="sourceLineNo">194</span><a id="line.194">    /**</a>
<span class="sourceLineNo">195</span><a id="line.195">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">196</span><a id="line.196">     * invoking a {@code getBoolean} method.</a>
<span class="sourceLineNo">197</span><a id="line.197">     *</a>
<span class="sourceLineNo">198</span><a id="line.198">     * @return the value</a>
<span class="sourceLineNo">199</span><a id="line.199">     */</a>
<span class="sourceLineNo">200</span><a id="line.200">    public boolean getNullBoolean() {</a>
<span class="sourceLineNo">201</span><a id="line.201">        return this.nullBoolean;</a>
<span class="sourceLineNo">202</span><a id="line.202">    }</a>
<span class="sourceLineNo">203</span><a id="line.203"></a>
<span class="sourceLineNo">204</span><a id="line.204">    /**</a>
<span class="sourceLineNo">205</span><a id="line.205">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">206</span><a id="line.206">     * invoking a {@code getByte} method.</a>
<span class="sourceLineNo">207</span><a id="line.207">     *</a>
<span class="sourceLineNo">208</span><a id="line.208">     * @return the value</a>
<span class="sourceLineNo">209</span><a id="line.209">     */</a>
<span class="sourceLineNo">210</span><a id="line.210">    public byte getNullByte() {</a>
<span class="sourceLineNo">211</span><a id="line.211">        return this.nullByte;</a>
<span class="sourceLineNo">212</span><a id="line.212">    }</a>
<span class="sourceLineNo">213</span><a id="line.213"></a>
<span class="sourceLineNo">214</span><a id="line.214">    /**</a>
<span class="sourceLineNo">215</span><a id="line.215">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">216</span><a id="line.216">     * invoking a {@code getBytes} method.</a>
<span class="sourceLineNo">217</span><a id="line.217">     *</a>
<span class="sourceLineNo">218</span><a id="line.218">     * @return the value</a>
<span class="sourceLineNo">219</span><a id="line.219">     */</a>
<span class="sourceLineNo">220</span><a id="line.220">    public byte[] getNullBytes() {</a>
<span class="sourceLineNo">221</span><a id="line.221">        if (this.nullBytes == null) {</a>
<span class="sourceLineNo">222</span><a id="line.222">            return null;</a>
<span class="sourceLineNo">223</span><a id="line.223">        }</a>
<span class="sourceLineNo">224</span><a id="line.224">        final byte[] copy = new byte[this.nullBytes.length];</a>
<span class="sourceLineNo">225</span><a id="line.225">        System.arraycopy(this.nullBytes, 0, copy, 0, this.nullBytes.length);</a>
<span class="sourceLineNo">226</span><a id="line.226">        return copy;</a>
<span class="sourceLineNo">227</span><a id="line.227">    }</a>
<span class="sourceLineNo">228</span><a id="line.228"></a>
<span class="sourceLineNo">229</span><a id="line.229">    /**</a>
<span class="sourceLineNo">230</span><a id="line.230">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">231</span><a id="line.231">     * invoking a {@code getCharacterStream} method.</a>
<span class="sourceLineNo">232</span><a id="line.232">     *</a>
<span class="sourceLineNo">233</span><a id="line.233">     * @return the value</a>
<span class="sourceLineNo">234</span><a id="line.234">     */</a>
<span class="sourceLineNo">235</span><a id="line.235">    public Reader getNullCharacterStream() {</a>
<span class="sourceLineNo">236</span><a id="line.236">        return this.nullCharacterStream;</a>
<span class="sourceLineNo">237</span><a id="line.237">    }</a>
<span class="sourceLineNo">238</span><a id="line.238"></a>
<span class="sourceLineNo">239</span><a id="line.239">    /**</a>
<span class="sourceLineNo">240</span><a id="line.240">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">241</span><a id="line.241">     * invoking a {@code getClob} method.</a>
<span class="sourceLineNo">242</span><a id="line.242">     *</a>
<span class="sourceLineNo">243</span><a id="line.243">     * @return the value</a>
<span class="sourceLineNo">244</span><a id="line.244">     */</a>
<span class="sourceLineNo">245</span><a id="line.245">    public Clob getNullClob() {</a>
<span class="sourceLineNo">246</span><a id="line.246">        return this.nullClob;</a>
<span class="sourceLineNo">247</span><a id="line.247">    }</a>
<span class="sourceLineNo">248</span><a id="line.248"></a>
<span class="sourceLineNo">249</span><a id="line.249">    /**</a>
<span class="sourceLineNo">250</span><a id="line.250">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">251</span><a id="line.251">     * invoking a {@code getDate} method.</a>
<span class="sourceLineNo">252</span><a id="line.252">     *</a>
<span class="sourceLineNo">253</span><a id="line.253">     * @return the value</a>
<span class="sourceLineNo">254</span><a id="line.254">     */</a>
<span class="sourceLineNo">255</span><a id="line.255">    public Date getNullDate() {</a>
<span class="sourceLineNo">256</span><a id="line.256">        return this.nullDate != null ? new Date(this.nullDate.getTime()) : null;</a>
<span class="sourceLineNo">257</span><a id="line.257">    }</a>
<span class="sourceLineNo">258</span><a id="line.258"></a>
<span class="sourceLineNo">259</span><a id="line.259">    /**</a>
<span class="sourceLineNo">260</span><a id="line.260">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">261</span><a id="line.261">     * invoking a {@code getDouble} method.</a>
<span class="sourceLineNo">262</span><a id="line.262">     *</a>
<span class="sourceLineNo">263</span><a id="line.263">     * @return the value</a>
<span class="sourceLineNo">264</span><a id="line.264">     */</a>
<span class="sourceLineNo">265</span><a id="line.265">    public double getNullDouble() {</a>
<span class="sourceLineNo">266</span><a id="line.266">        return this.nullDouble;</a>
<span class="sourceLineNo">267</span><a id="line.267">    }</a>
<span class="sourceLineNo">268</span><a id="line.268"></a>
<span class="sourceLineNo">269</span><a id="line.269">    /**</a>
<span class="sourceLineNo">270</span><a id="line.270">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">271</span><a id="line.271">     * invoking a {@code getFloat} method.</a>
<span class="sourceLineNo">272</span><a id="line.272">     *</a>
<span class="sourceLineNo">273</span><a id="line.273">     * @return the value</a>
<span class="sourceLineNo">274</span><a id="line.274">     */</a>
<span class="sourceLineNo">275</span><a id="line.275">    public float getNullFloat() {</a>
<span class="sourceLineNo">276</span><a id="line.276">        return this.nullFloat;</a>
<span class="sourceLineNo">277</span><a id="line.277">    }</a>
<span class="sourceLineNo">278</span><a id="line.278"></a>
<span class="sourceLineNo">279</span><a id="line.279">    /**</a>
<span class="sourceLineNo">280</span><a id="line.280">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">281</span><a id="line.281">     * invoking a {@code getInt} method.</a>
<span class="sourceLineNo">282</span><a id="line.282">     *</a>
<span class="sourceLineNo">283</span><a id="line.283">     * @return the value</a>
<span class="sourceLineNo">284</span><a id="line.284">     */</a>
<span class="sourceLineNo">285</span><a id="line.285">    public int getNullInt() {</a>
<span class="sourceLineNo">286</span><a id="line.286">        return this.nullInt;</a>
<span class="sourceLineNo">287</span><a id="line.287">    }</a>
<span class="sourceLineNo">288</span><a id="line.288"></a>
<span class="sourceLineNo">289</span><a id="line.289">    /**</a>
<span class="sourceLineNo">290</span><a id="line.290">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">291</span><a id="line.291">     * invoking a {@code getLong} method.</a>
<span class="sourceLineNo">292</span><a id="line.292">     *</a>
<span class="sourceLineNo">293</span><a id="line.293">     * @return the value</a>
<span class="sourceLineNo">294</span><a id="line.294">     */</a>
<span class="sourceLineNo">295</span><a id="line.295">    public long getNullLong() {</a>
<span class="sourceLineNo">296</span><a id="line.296">        return this.nullLong;</a>
<span class="sourceLineNo">297</span><a id="line.297">    }</a>
<span class="sourceLineNo">298</span><a id="line.298"></a>
<span class="sourceLineNo">299</span><a id="line.299">    /**</a>
<span class="sourceLineNo">300</span><a id="line.300">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">301</span><a id="line.301">     * invoking a {@code getObject} method.</a>
<span class="sourceLineNo">302</span><a id="line.302">     *</a>
<span class="sourceLineNo">303</span><a id="line.303">     * @return the value</a>
<span class="sourceLineNo">304</span><a id="line.304">     */</a>
<span class="sourceLineNo">305</span><a id="line.305">    public Object getNullObject() {</a>
<span class="sourceLineNo">306</span><a id="line.306">        return this.nullObject;</a>
<span class="sourceLineNo">307</span><a id="line.307">    }</a>
<span class="sourceLineNo">308</span><a id="line.308"></a>
<span class="sourceLineNo">309</span><a id="line.309">    /**</a>
<span class="sourceLineNo">310</span><a id="line.310">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">311</span><a id="line.311">     * invoking a {@code getRef} method.</a>
<span class="sourceLineNo">312</span><a id="line.312">     *</a>
<span class="sourceLineNo">313</span><a id="line.313">     * @return the value</a>
<span class="sourceLineNo">314</span><a id="line.314">     */</a>
<span class="sourceLineNo">315</span><a id="line.315">    public Ref getNullRef() {</a>
<span class="sourceLineNo">316</span><a id="line.316">        return this.nullRef;</a>
<span class="sourceLineNo">317</span><a id="line.317">    }</a>
<span class="sourceLineNo">318</span><a id="line.318"></a>
<span class="sourceLineNo">319</span><a id="line.319">    /**</a>
<span class="sourceLineNo">320</span><a id="line.320">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">321</span><a id="line.321">     * invoking a {@code getShort} method.</a>
<span class="sourceLineNo">322</span><a id="line.322">     *</a>
<span class="sourceLineNo">323</span><a id="line.323">     * @return the value</a>
<span class="sourceLineNo">324</span><a id="line.324">     */</a>
<span class="sourceLineNo">325</span><a id="line.325">    public short getNullShort() {</a>
<span class="sourceLineNo">326</span><a id="line.326">        return this.nullShort;</a>
<span class="sourceLineNo">327</span><a id="line.327">    }</a>
<span class="sourceLineNo">328</span><a id="line.328"></a>
<span class="sourceLineNo">329</span><a id="line.329">    /**</a>
<span class="sourceLineNo">330</span><a id="line.330">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">331</span><a id="line.331">     * invoking a {@code getString} method.</a>
<span class="sourceLineNo">332</span><a id="line.332">     *</a>
<span class="sourceLineNo">333</span><a id="line.333">     * @return the value</a>
<span class="sourceLineNo">334</span><a id="line.334">     */</a>
<span class="sourceLineNo">335</span><a id="line.335">    public String getNullString() {</a>
<span class="sourceLineNo">336</span><a id="line.336">        return this.nullString;</a>
<span class="sourceLineNo">337</span><a id="line.337">    }</a>
<span class="sourceLineNo">338</span><a id="line.338"></a>
<span class="sourceLineNo">339</span><a id="line.339">    /**</a>
<span class="sourceLineNo">340</span><a id="line.340">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">341</span><a id="line.341">     * invoking a {@code getTime} method.</a>
<span class="sourceLineNo">342</span><a id="line.342">     *</a>
<span class="sourceLineNo">343</span><a id="line.343">     * @return the value</a>
<span class="sourceLineNo">344</span><a id="line.344">     */</a>
<span class="sourceLineNo">345</span><a id="line.345">    public Time getNullTime() {</a>
<span class="sourceLineNo">346</span><a id="line.346">        return this.nullTime != null ? new Time(this.nullTime.getTime()) : null;</a>
<span class="sourceLineNo">347</span><a id="line.347">    }</a>
<span class="sourceLineNo">348</span><a id="line.348"></a>
<span class="sourceLineNo">349</span><a id="line.349">    /**</a>
<span class="sourceLineNo">350</span><a id="line.350">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">351</span><a id="line.351">     * invoking a {@code getTimestamp} method.</a>
<span class="sourceLineNo">352</span><a id="line.352">     *</a>
<span class="sourceLineNo">353</span><a id="line.353">     * @return the value</a>
<span class="sourceLineNo">354</span><a id="line.354">     */</a>
<span class="sourceLineNo">355</span><a id="line.355">    public Timestamp getNullTimestamp() {</a>
<span class="sourceLineNo">356</span><a id="line.356">        if (this.nullTimestamp == null) {</a>
<span class="sourceLineNo">357</span><a id="line.357">            return null;</a>
<span class="sourceLineNo">358</span><a id="line.358">        }</a>
<span class="sourceLineNo">359</span><a id="line.359"></a>
<span class="sourceLineNo">360</span><a id="line.360">        Timestamp ts = new Timestamp(this.nullTimestamp.getTime());</a>
<span class="sourceLineNo">361</span><a id="line.361">        ts.setNanos(this.nullTimestamp.getNanos());</a>
<span class="sourceLineNo">362</span><a id="line.362">        return ts;</a>
<span class="sourceLineNo">363</span><a id="line.363">    }</a>
<span class="sourceLineNo">364</span><a id="line.364"></a>
<span class="sourceLineNo">365</span><a id="line.365">    /**</a>
<span class="sourceLineNo">366</span><a id="line.366">     * Returns the value when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">367</span><a id="line.367">     * invoking a {@code getURL} method.</a>
<span class="sourceLineNo">368</span><a id="line.368">     *</a>
<span class="sourceLineNo">369</span><a id="line.369">     * @return the value</a>
<span class="sourceLineNo">370</span><a id="line.370">     */</a>
<span class="sourceLineNo">371</span><a id="line.371">    public URL getNullURL() {</a>
<span class="sourceLineNo">372</span><a id="line.372">        return this.nullURL;</a>
<span class="sourceLineNo">373</span><a id="line.373">    }</a>
<span class="sourceLineNo">374</span><a id="line.374"></a>
<span class="sourceLineNo">375</span><a id="line.375">    /**</a>
<span class="sourceLineNo">376</span><a id="line.376">     * Intercepts calls to {@code get*} methods and calls the appropriate</a>
<span class="sourceLineNo">377</span><a id="line.377">     * {@code getNull*} method if the {@code ResultSet} returned</a>
<span class="sourceLineNo">378</span><a id="line.378">     * {@code null}.</a>
<span class="sourceLineNo">379</span><a id="line.379">     *</a>
<span class="sourceLineNo">380</span><a id="line.380">     *  @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])</a>
<span class="sourceLineNo">381</span><a id="line.381">     * @param proxy Not used; all method calls go to the internal result set</a>
<span class="sourceLineNo">382</span><a id="line.382">     * @param method The method to invoke on the result set</a>
<span class="sourceLineNo">383</span><a id="line.383">     * @param args The arguments to pass to the result set</a>
<span class="sourceLineNo">384</span><a id="line.384">     * @return null checked result</a>
<span class="sourceLineNo">385</span><a id="line.385">     * @throws Throwable error</a>
<span class="sourceLineNo">386</span><a id="line.386">     */</a>
<span class="sourceLineNo">387</span><a id="line.387">    @Override</a>
<span class="sourceLineNo">388</span><a id="line.388">    public Object invoke(final Object proxy, final Method method, final Object[] args)</a>
<span class="sourceLineNo">389</span><a id="line.389">        throws Throwable {</a>
<span class="sourceLineNo">390</span><a id="line.390"></a>
<span class="sourceLineNo">391</span><a id="line.391">        final Object result = method.invoke(this.rs, args);</a>
<span class="sourceLineNo">392</span><a id="line.392"></a>
<span class="sourceLineNo">393</span><a id="line.393">        final Method nullMethod = nullMethods.get(method.getName());</a>
<span class="sourceLineNo">394</span><a id="line.394"></a>
<span class="sourceLineNo">395</span><a id="line.395">        // Check nullMethod != null first so that we don't call wasNull()</a>
<span class="sourceLineNo">396</span><a id="line.396">        // before a true getter method was invoked on the ResultSet.</a>
<span class="sourceLineNo">397</span><a id="line.397">        return (nullMethod != null &amp;&amp; this.rs.wasNull())</a>
<span class="sourceLineNo">398</span><a id="line.398">            ? nullMethod.invoke(this, (Object[]) null)</a>
<span class="sourceLineNo">399</span><a id="line.399">            : result;</a>
<span class="sourceLineNo">400</span><a id="line.400">    }</a>
<span class="sourceLineNo">401</span><a id="line.401"></a>
<span class="sourceLineNo">402</span><a id="line.402">    /**</a>
<span class="sourceLineNo">403</span><a id="line.403">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">404</span><a id="line.404">     * invoking a {@code getAsciiStream} method.</a>
<span class="sourceLineNo">405</span><a id="line.405">     *</a>
<span class="sourceLineNo">406</span><a id="line.406">     * @param nullAsciiStream the value</a>
<span class="sourceLineNo">407</span><a id="line.407">     */</a>
<span class="sourceLineNo">408</span><a id="line.408">    public void setNullAsciiStream(final InputStream nullAsciiStream) {</a>
<span class="sourceLineNo">409</span><a id="line.409">        this.nullAsciiStream = nullAsciiStream;</a>
<span class="sourceLineNo">410</span><a id="line.410">    }</a>
<span class="sourceLineNo">411</span><a id="line.411"></a>
<span class="sourceLineNo">412</span><a id="line.412">    /**</a>
<span class="sourceLineNo">413</span><a id="line.413">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">414</span><a id="line.414">     * invoking a {@code getBigDecimal} method.</a>
<span class="sourceLineNo">415</span><a id="line.415">     *</a>
<span class="sourceLineNo">416</span><a id="line.416">     * @param nullBigDecimal the value</a>
<span class="sourceLineNo">417</span><a id="line.417">     */</a>
<span class="sourceLineNo">418</span><a id="line.418">    public void setNullBigDecimal(final BigDecimal nullBigDecimal) {</a>
<span class="sourceLineNo">419</span><a id="line.419">        this.nullBigDecimal = nullBigDecimal;</a>
<span class="sourceLineNo">420</span><a id="line.420">    }</a>
<span class="sourceLineNo">421</span><a id="line.421"></a>
<span class="sourceLineNo">422</span><a id="line.422">    /**</a>
<span class="sourceLineNo">423</span><a id="line.423">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">424</span><a id="line.424">     * invoking a {@code getBinaryStream} method.</a>
<span class="sourceLineNo">425</span><a id="line.425">     *</a>
<span class="sourceLineNo">426</span><a id="line.426">     * @param nullBinaryStream the value</a>
<span class="sourceLineNo">427</span><a id="line.427">     */</a>
<span class="sourceLineNo">428</span><a id="line.428">    public void setNullBinaryStream(final InputStream nullBinaryStream) {</a>
<span class="sourceLineNo">429</span><a id="line.429">        this.nullBinaryStream = nullBinaryStream;</a>
<span class="sourceLineNo">430</span><a id="line.430">    }</a>
<span class="sourceLineNo">431</span><a id="line.431"></a>
<span class="sourceLineNo">432</span><a id="line.432">    /**</a>
<span class="sourceLineNo">433</span><a id="line.433">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">434</span><a id="line.434">     * invoking a {@code getBlob} method.</a>
<span class="sourceLineNo">435</span><a id="line.435">     *</a>
<span class="sourceLineNo">436</span><a id="line.436">     * @param nullBlob the value</a>
<span class="sourceLineNo">437</span><a id="line.437">     */</a>
<span class="sourceLineNo">438</span><a id="line.438">    public void setNullBlob(final Blob nullBlob) {</a>
<span class="sourceLineNo">439</span><a id="line.439">        this.nullBlob = nullBlob;</a>
<span class="sourceLineNo">440</span><a id="line.440">    }</a>
<span class="sourceLineNo">441</span><a id="line.441"></a>
<span class="sourceLineNo">442</span><a id="line.442">    /**</a>
<span class="sourceLineNo">443</span><a id="line.443">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">444</span><a id="line.444">     * invoking a {@code getBoolean} method.</a>
<span class="sourceLineNo">445</span><a id="line.445">     *</a>
<span class="sourceLineNo">446</span><a id="line.446">     * @param nullBoolean the value</a>
<span class="sourceLineNo">447</span><a id="line.447">     */</a>
<span class="sourceLineNo">448</span><a id="line.448">    public void setNullBoolean(final boolean nullBoolean) {</a>
<span class="sourceLineNo">449</span><a id="line.449">        this.nullBoolean = nullBoolean;</a>
<span class="sourceLineNo">450</span><a id="line.450">    }</a>
<span class="sourceLineNo">451</span><a id="line.451"></a>
<span class="sourceLineNo">452</span><a id="line.452">    /**</a>
<span class="sourceLineNo">453</span><a id="line.453">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">454</span><a id="line.454">     * invoking a {@code getByte} method.</a>
<span class="sourceLineNo">455</span><a id="line.455">     *</a>
<span class="sourceLineNo">456</span><a id="line.456">     * @param nullByte the value</a>
<span class="sourceLineNo">457</span><a id="line.457">     */</a>
<span class="sourceLineNo">458</span><a id="line.458">    public void setNullByte(final byte nullByte) {</a>
<span class="sourceLineNo">459</span><a id="line.459">        this.nullByte = nullByte;</a>
<span class="sourceLineNo">460</span><a id="line.460">    }</a>
<span class="sourceLineNo">461</span><a id="line.461"></a>
<span class="sourceLineNo">462</span><a id="line.462">    /**</a>
<span class="sourceLineNo">463</span><a id="line.463">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">464</span><a id="line.464">     * invoking a {@code getBytes} method.</a>
<span class="sourceLineNo">465</span><a id="line.465">     *</a>
<span class="sourceLineNo">466</span><a id="line.466">     * @param nullBytes the value</a>
<span class="sourceLineNo">467</span><a id="line.467">     */</a>
<span class="sourceLineNo">468</span><a id="line.468">    public void setNullBytes(final byte[] nullBytes) {</a>
<span class="sourceLineNo">469</span><a id="line.469">        if (nullBytes != null) {</a>
<span class="sourceLineNo">470</span><a id="line.470">            final byte[] copy = new byte[nullBytes.length];</a>
<span class="sourceLineNo">471</span><a id="line.471">            System.arraycopy(nullBytes, 0, copy, 0, nullBytes.length);</a>
<span class="sourceLineNo">472</span><a id="line.472">            this.nullBytes = copy;</a>
<span class="sourceLineNo">473</span><a id="line.473">        } else {</a>
<span class="sourceLineNo">474</span><a id="line.474">            this.nullBytes = null;</a>
<span class="sourceLineNo">475</span><a id="line.475">        }</a>
<span class="sourceLineNo">476</span><a id="line.476">    }</a>
<span class="sourceLineNo">477</span><a id="line.477"></a>
<span class="sourceLineNo">478</span><a id="line.478">    /**</a>
<span class="sourceLineNo">479</span><a id="line.479">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">480</span><a id="line.480">     * invoking a {@code getCharacterStream} method.</a>
<span class="sourceLineNo">481</span><a id="line.481">     *</a>
<span class="sourceLineNo">482</span><a id="line.482">     * @param nullCharacterStream the value</a>
<span class="sourceLineNo">483</span><a id="line.483">     */</a>
<span class="sourceLineNo">484</span><a id="line.484">    public void setNullCharacterStream(final Reader nullCharacterStream) {</a>
<span class="sourceLineNo">485</span><a id="line.485">        this.nullCharacterStream = nullCharacterStream;</a>
<span class="sourceLineNo">486</span><a id="line.486">    }</a>
<span class="sourceLineNo">487</span><a id="line.487"></a>
<span class="sourceLineNo">488</span><a id="line.488">    /**</a>
<span class="sourceLineNo">489</span><a id="line.489">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">490</span><a id="line.490">     * invoking a {@code getClob} method.</a>
<span class="sourceLineNo">491</span><a id="line.491">     *</a>
<span class="sourceLineNo">492</span><a id="line.492">     * @param nullClob the value</a>
<span class="sourceLineNo">493</span><a id="line.493">     */</a>
<span class="sourceLineNo">494</span><a id="line.494">    public void setNullClob(final Clob nullClob) {</a>
<span class="sourceLineNo">495</span><a id="line.495">        this.nullClob = nullClob;</a>
<span class="sourceLineNo">496</span><a id="line.496">    }</a>
<span class="sourceLineNo">497</span><a id="line.497"></a>
<span class="sourceLineNo">498</span><a id="line.498">    /**</a>
<span class="sourceLineNo">499</span><a id="line.499">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">500</span><a id="line.500">     * invoking a {@code getDate} method.</a>
<span class="sourceLineNo">501</span><a id="line.501">     *</a>
<span class="sourceLineNo">502</span><a id="line.502">     * @param nullDate the value</a>
<span class="sourceLineNo">503</span><a id="line.503">     */</a>
<span class="sourceLineNo">504</span><a id="line.504">    public void setNullDate(final Date nullDate) {</a>
<span class="sourceLineNo">505</span><a id="line.505">        this.nullDate = nullDate != null ? new Date(nullDate.getTime()) : null;</a>
<span class="sourceLineNo">506</span><a id="line.506">    }</a>
<span class="sourceLineNo">507</span><a id="line.507"></a>
<span class="sourceLineNo">508</span><a id="line.508">    /**</a>
<span class="sourceLineNo">509</span><a id="line.509">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">510</span><a id="line.510">     * invoking a {@code getDouble} method.</a>
<span class="sourceLineNo">511</span><a id="line.511">     *</a>
<span class="sourceLineNo">512</span><a id="line.512">     * @param nullDouble the value</a>
<span class="sourceLineNo">513</span><a id="line.513">     */</a>
<span class="sourceLineNo">514</span><a id="line.514">    public void setNullDouble(final double nullDouble) {</a>
<span class="sourceLineNo">515</span><a id="line.515">        this.nullDouble = nullDouble;</a>
<span class="sourceLineNo">516</span><a id="line.516">    }</a>
<span class="sourceLineNo">517</span><a id="line.517"></a>
<span class="sourceLineNo">518</span><a id="line.518">    /**</a>
<span class="sourceLineNo">519</span><a id="line.519">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">520</span><a id="line.520">     * invoking a {@code getFloat} method.</a>
<span class="sourceLineNo">521</span><a id="line.521">     *</a>
<span class="sourceLineNo">522</span><a id="line.522">     * @param nullFloat the value</a>
<span class="sourceLineNo">523</span><a id="line.523">     */</a>
<span class="sourceLineNo">524</span><a id="line.524">    public void setNullFloat(final float nullFloat) {</a>
<span class="sourceLineNo">525</span><a id="line.525">        this.nullFloat = nullFloat;</a>
<span class="sourceLineNo">526</span><a id="line.526">    }</a>
<span class="sourceLineNo">527</span><a id="line.527"></a>
<span class="sourceLineNo">528</span><a id="line.528">    /**</a>
<span class="sourceLineNo">529</span><a id="line.529">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">530</span><a id="line.530">     * invoking a {@code getInt} method.</a>
<span class="sourceLineNo">531</span><a id="line.531">     *</a>
<span class="sourceLineNo">532</span><a id="line.532">     * @param nullInt the value</a>
<span class="sourceLineNo">533</span><a id="line.533">     */</a>
<span class="sourceLineNo">534</span><a id="line.534">    public void setNullInt(final int nullInt) {</a>
<span class="sourceLineNo">535</span><a id="line.535">        this.nullInt = nullInt;</a>
<span class="sourceLineNo">536</span><a id="line.536">    }</a>
<span class="sourceLineNo">537</span><a id="line.537"></a>
<span class="sourceLineNo">538</span><a id="line.538">    /**</a>
<span class="sourceLineNo">539</span><a id="line.539">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">540</span><a id="line.540">     * invoking a {@code getLong} method.</a>
<span class="sourceLineNo">541</span><a id="line.541">     *</a>
<span class="sourceLineNo">542</span><a id="line.542">     * @param nullLong the value</a>
<span class="sourceLineNo">543</span><a id="line.543">     */</a>
<span class="sourceLineNo">544</span><a id="line.544">    public void setNullLong(final long nullLong) {</a>
<span class="sourceLineNo">545</span><a id="line.545">        this.nullLong = nullLong;</a>
<span class="sourceLineNo">546</span><a id="line.546">    }</a>
<span class="sourceLineNo">547</span><a id="line.547"></a>
<span class="sourceLineNo">548</span><a id="line.548">    /**</a>
<span class="sourceLineNo">549</span><a id="line.549">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">550</span><a id="line.550">     * invoking a {@code getObject} method.</a>
<span class="sourceLineNo">551</span><a id="line.551">     *</a>
<span class="sourceLineNo">552</span><a id="line.552">     * @param nullObject the value</a>
<span class="sourceLineNo">553</span><a id="line.553">     */</a>
<span class="sourceLineNo">554</span><a id="line.554">    public void setNullObject(final Object nullObject) {</a>
<span class="sourceLineNo">555</span><a id="line.555">        this.nullObject = nullObject;</a>
<span class="sourceLineNo">556</span><a id="line.556">    }</a>
<span class="sourceLineNo">557</span><a id="line.557"></a>
<span class="sourceLineNo">558</span><a id="line.558">    /**</a>
<span class="sourceLineNo">559</span><a id="line.559">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">560</span><a id="line.560">     * invoking a {@code getRef} method.</a>
<span class="sourceLineNo">561</span><a id="line.561">     *</a>
<span class="sourceLineNo">562</span><a id="line.562">     * @param nullRef the value</a>
<span class="sourceLineNo">563</span><a id="line.563">     */</a>
<span class="sourceLineNo">564</span><a id="line.564">    public void setNullRef(final Ref nullRef) {</a>
<span class="sourceLineNo">565</span><a id="line.565">        this.nullRef = nullRef;</a>
<span class="sourceLineNo">566</span><a id="line.566">    }</a>
<span class="sourceLineNo">567</span><a id="line.567"></a>
<span class="sourceLineNo">568</span><a id="line.568">    /**</a>
<span class="sourceLineNo">569</span><a id="line.569">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">570</span><a id="line.570">     * invoking a {@code getShort} method.</a>
<span class="sourceLineNo">571</span><a id="line.571">     *</a>
<span class="sourceLineNo">572</span><a id="line.572">     * @param nullShort the value</a>
<span class="sourceLineNo">573</span><a id="line.573">     */</a>
<span class="sourceLineNo">574</span><a id="line.574">    public void setNullShort(final short nullShort) {</a>
<span class="sourceLineNo">575</span><a id="line.575">        this.nullShort = nullShort;</a>
<span class="sourceLineNo">576</span><a id="line.576">    }</a>
<span class="sourceLineNo">577</span><a id="line.577"></a>
<span class="sourceLineNo">578</span><a id="line.578">    /**</a>
<span class="sourceLineNo">579</span><a id="line.579">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">580</span><a id="line.580">     * invoking a {@code getString} method.</a>
<span class="sourceLineNo">581</span><a id="line.581">     *</a>
<span class="sourceLineNo">582</span><a id="line.582">     * @param nullString the value</a>
<span class="sourceLineNo">583</span><a id="line.583">     */</a>
<span class="sourceLineNo">584</span><a id="line.584">    public void setNullString(final String nullString) {</a>
<span class="sourceLineNo">585</span><a id="line.585">        this.nullString = nullString;</a>
<span class="sourceLineNo">586</span><a id="line.586">    }</a>
<span class="sourceLineNo">587</span><a id="line.587"></a>
<span class="sourceLineNo">588</span><a id="line.588">    /**</a>
<span class="sourceLineNo">589</span><a id="line.589">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">590</span><a id="line.590">     * invoking a {@code getTime} method.</a>
<span class="sourceLineNo">591</span><a id="line.591">     *</a>
<span class="sourceLineNo">592</span><a id="line.592">     * @param nullTime the value</a>
<span class="sourceLineNo">593</span><a id="line.593">     */</a>
<span class="sourceLineNo">594</span><a id="line.594">    public void setNullTime(final Time nullTime) {</a>
<span class="sourceLineNo">595</span><a id="line.595">        this.nullTime = nullTime != null ? new Time(nullTime.getTime()) : null;</a>
<span class="sourceLineNo">596</span><a id="line.596">    }</a>
<span class="sourceLineNo">597</span><a id="line.597"></a>
<span class="sourceLineNo">598</span><a id="line.598">    /**</a>
<span class="sourceLineNo">599</span><a id="line.599">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">600</span><a id="line.600">     * invoking a {@code getTimestamp} method.</a>
<span class="sourceLineNo">601</span><a id="line.601">     *</a>
<span class="sourceLineNo">602</span><a id="line.602">     * @param nullTimestamp the value</a>
<span class="sourceLineNo">603</span><a id="line.603">     */</a>
<span class="sourceLineNo">604</span><a id="line.604">    public void setNullTimestamp(final Timestamp nullTimestamp) {</a>
<span class="sourceLineNo">605</span><a id="line.605">        if (nullTimestamp != null) {</a>
<span class="sourceLineNo">606</span><a id="line.606">            this.nullTimestamp = new Timestamp(nullTimestamp.getTime());</a>
<span class="sourceLineNo">607</span><a id="line.607">            this.nullTimestamp.setNanos(nullTimestamp.getNanos());</a>
<span class="sourceLineNo">608</span><a id="line.608">        } else {</a>
<span class="sourceLineNo">609</span><a id="line.609">            this.nullTimestamp = null;</a>
<span class="sourceLineNo">610</span><a id="line.610">        }</a>
<span class="sourceLineNo">611</span><a id="line.611">    }</a>
<span class="sourceLineNo">612</span><a id="line.612"></a>
<span class="sourceLineNo">613</span><a id="line.613">    /**</a>
<span class="sourceLineNo">614</span><a id="line.614">     * Sets the value to return when a SQL null is encountered as the result of</a>
<span class="sourceLineNo">615</span><a id="line.615">     * invoking a {@code getURL} method.</a>
<span class="sourceLineNo">616</span><a id="line.616">     *</a>
<span class="sourceLineNo">617</span><a id="line.617">     * @param nullURL the value</a>
<span class="sourceLineNo">618</span><a id="line.618">     */</a>
<span class="sourceLineNo">619</span><a id="line.619">    public void setNullURL(final URL nullURL) {</a>
<span class="sourceLineNo">620</span><a id="line.620">        this.nullURL = nullURL;</a>
<span class="sourceLineNo">621</span><a id="line.621">    }</a>
<span class="sourceLineNo">622</span><a id="line.622"></a>
<span class="sourceLineNo">623</span><a id="line.623">}</a>




























































</pre>
</div>
</main>
</body>
</html>
